<?php
/************************FoxPHP威客系统************************/
/*                                                            */
/*  FoxPHP.Com (C)2006-2016 FoxPHP Inc.                       */
/*  This is NOT a freeware, use is subject to license terms   */
/*  FoxPHP威客系统是商业软件,使用于商业用途请购买授权         */
/*  V3.0 2016.3                                               */
/*  foxphp@aliyun.com                                         */
/*  http://www.foxphp.com                                     */
/*                                                            */
/**************************************************************/

namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
	
    public function indexAction(){
		
		//幻灯片
		$slidearray=M('Slide')->token(false)->where(" status=1 AND type=1 ")->order('displayorder ASC')->select();
		$this->assign('slidearray',$slidearray);
		
		//公告
		$articlearray=M('Article')->token(false)->where(" catid=46 ")->order('dateline DESC')->limit(5)->select();
		$this->assign('articlearray',$articlearray);
		
		//分类列表-------------------------------------------------------------------------
		$catids='1,2,3,4,5,6,7,8';
		$categoryarray=M('Category')->token(false)->where(" catid IN($catids) ")->field('catid,upid,name,route,logo,nexts')->order('displayorder ASC')->select();
		if(!empty($categoryarray)){
			foreach($categoryarray as $key=>$value){
				//二级
				$nexts=$value['nexts'];
				$upid=$value['catid'];
				if($nexts && $upid>0){
					$categoryarray[$key]['subclass']=M('Category')->token(false)->where(" upid=$upid ")->order('displayorder ASC')->field('catid,upid,name,route,logo,task,service')->limit(12)->select();
					$categoryarray[$key]['user']=M('Member')->token(false)->where(" catid IN($nexts) AND isshop=1 ")->field('uid,shopname,username,isvip,level,ability_level,newdata,seller_haopinglu,seller_level')->limit(8)->select();
				}
			}
		}
		
		// $this->assign('categoryarray',$categoryarray);
		//-------------------------------------------------------------------------
		
		$model=new \Data\Model\DataModel();
		//推荐12
		$toptask=$model->GetCustomData(' type=1 AND task_mode<3 AND process>3 AND process<6 AND top>0 ','dateline DESC',12);
		$this->assign('toptask',$toptask);
		
		//最新12
		$newtask=$model->GetCustomData(' type=1 AND task_mode<3 AND process>3 AND process<6','dateline DESC',12);
		$this->assign('newtask',$newtask);
		
		//热门12
		$hottask=$model->GetCustomData(' type=1 AND task_mode<3 AND process>3 AND process<6','show_number DESC',12);
		$this->assign('hottask',$hottask);
		
		//-------------------------------------------------------------------------
		//动态
		$feedarray=M('MemberFeed')->token(false)->order('dateline DESC')->limit(18)->select();
		$this->assign('feedarray',$feedarray);
		
		$this->assign('PATH',array('1000qian'));
		$this->assign('SEO',array('title'=>'1000qian','keywords'=>'1000qian,网络接单','description'=>'网站首页'));
		
		$this->display();
    }
}